home *** CD-ROM | disk | FTP | other *** search
- /*
- * applport.h
- *
- * Author: Tomi Ollila <too@cs.hut.fi>
- *
- * Copyright (c) 1993 Tomi Ollila
- * All rights reserved
- *
- * Created: Fri Nov 5 17:55:48 1993 too
- * Last modified: Mon Nov 15 18:05:13 1993 too
- *
- * HISTORY
- * $Log: applport.h,v $
- * Revision 1.1 1993/11/17 11:47:44 too
- * Initial revision
- *
- */
-
- #ifndef _APPLPORT_H_
- #define _APPLPORT_H_
-
- #ifndef EXEC_INTERRUPTS_H
- #include <exec/interrupts.h>
- #endif
-
- #ifndef DEVICES_TIMER_H
- #include <devices/timer.h>
- #endif
-
- #include <sys/types.h>
-
- #ifndef inline
- #define inline __inline
- #endif
-
- /*
- * Application info object to always rendezvous w/ right application. This
- * always exists w/ the application that has handler open. waitforchar and
- * write structures are created at need. Since the use of IoctlSocket() the
- * whole WaitForPort structure shrunk into one timerequest structure which
- * is now incorporated into this module. This simplified the code a great
- * deal :) (r1.4 -> r1.5)
- */
-
- struct ApplMsgPort {
- struct MsgPort amp_Msgport;
- struct Interrupt amp_Interrupt;
- };
-
- void initApplMsgPort(struct ApplMsgPort * port);
-
- struct ApplShared;
- struct PendingWrites;
- struct ApplPort {
- struct ApplMsgPort ap_AMP; /* */
- struct ApplShared * ap_AS;
- struct Task * ap_Task; /* task pointer of orig opener */
- LONG ap_Sd; /* socket fd for application */
- BYTE ap_OpenCnt; /* Open() + reopens */
- BYTE ap_Disb; /* data in socket buffer ? */
- struct PendingWrites* ap_Pw; /* pointer to my pending write */
- struct DosPacket * ap_Packet; /* packet in */
- struct timerequest ap_Tr; /* Request for timer message. */
- };
-
- struct PendingWrites {
- struct Node pw_Link; /* link freed pending nodes together */
- struct ApplPort * pw_Applport; /* link to application */
- char * pw_Start; /* start addres of not written data and ..*/
- int pw_Left; /* ... bytes not written (current pw) */
- int pw_Len; /* length of data for final ReplyPkt() */
- struct DosPacket * pw_Packet; /* Write packet pending */
- };
-
- /*
- * Data reachable from application structures
- */
-
- struct ApplShared {
- struct ApplPort * as_applcbbuf[0x40]; /* hardcoded :( */
- LONG as_applcbpos;
- LONG as_applcbcur; /* here for consistency */
- struct Task * as_me;
- ULONG as_applportflag;
- };
-
- #define applcbbuf AS RFI as_applcbbuf
- #define applcbpos AS RFI as_applcbpos
- #define applcbcur AS RFI as_applcbcur
- #define me AS RFI as_me
- #define applportflag AS RFI as_applportflag
-
- static inline void
- NewList(struct List * list)
- {
- list->lh_Head = (struct Node *)&list->lh_Tail;
- list->lh_Tail = 0;
- list->lh_TailPred = (struct Node *)&list->lh_Head;
- }
-
- #endif /* _APPLPORT_H_ */
-